<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		    <link rel="stylesheet" href="bower_components/layer/layer.css" />
		
		<script src="bower_components/jquery/dist/jquery.min.js"></script>
		<script src="bower_components/layer/layer.js"></script>
		<script type="text/javascript" src="js/jq.cookie.js" ></script>
		<script></script>
	</head>
	<style>
		div{
			width:400px;
			height: 250px;
			
			text-align: center;
		}
		label{
			margin-right: 20px;
		}
		select,.input_text{
			width: 240px;
			height: 30px;
		}
		.submit{
			width: 100px;
			background: skyblue;
			color: white;
			cursor: pointer;
			border: none;
			height: 35px;
			margin-top: 30px!important;
		}
		label ,input,select{
			margin-top: 30px;
		}
body .demo-class .layui-layer-title{background:#eea2bb; color:#fff; border: none;}
body .demo-class .layui-layer-btn{border-color:1px solid #eea2bb}
body .demo-class .layui-layer-btn a{background:white;}
body .demo-class .layui-layer-btn .layui-layer-btn0{background:#eea2bb;border:none;}
body .demo-class .layui-layer-btn .layui-layer-btn1{background:#ffffff;}		
	</style>
	<body>
		
		<div>
			<label>项目名称:</label><select></select><br />
			<label>客户名称:</label><select></select><br />
			<label>划圈留言:</label><input class="input_text" type="text" /><br />
			<input class="submit" type="button" value="提交"/>
		</div>
	</body>
</html>
<script>
	$(document).ready(function(){
		$.ajax({
			type:"get",
			url:"http://www.duoweish.com/apis/SalesInfo/",
			async:true,
			success:function(data){
				for (var i = 0; i<data[1].length;i++) {
					var OPtio = '<option>'+data[1][i]+'</option>';
					$("select").eq(0).append(OPtio);
				}
				for (var i = 0; i<data[0].length;i++) {
					var OPtio2 = '<option>'+data[0][i]+'</option>';
					$("select").eq(1).append(OPtio2);
				}
				
			}
		});
		$('.submit').click(function(){
			var sel_item = $("select").eq(0).find("option:selected").text();
			var sel_name = $("select").eq(1).find("option:selected").text();
			var input_value = $('.input_text').val();
			if(input_value==''){
  								parent.layer.msg('留言不能为空',{
  									time:1000,
  								});				
			}else{
				$.ajax({
				type:"get",
				url:"http://www.duoweish.com/apis/NewImportBs/",
				async:true,
				data:{
					UserId:$.cookie('ID'),
					Cstm:sel_name,
					Project:sel_item,
					Content:input_value
				},
				success:function(){
							 parent.layer.msg('提交成功',{time:500},function(){
							 	 parent.layer.closeAll();
							 });
							
				}
			});
			}
			
		})
	})
</script>




